class Solution {
public:
    vector<vector<int>> modifiedMatrix(vector<vector<int>>& matrix)
    {
        for (int l = 0; l < matrix.size(); l++)
        {
            for (int i = 0; i < matrix[l].size(); i++)
            {
                if (matrix[l][i] == -1)
                {
                    int mx = 0;
                    for (int j = 0; j < matrix.size(); j++) mx = max(mx, matrix[j][i]);
                    matrix[l][i] = mx;
                }
            }
        }
        return matrix;
    }
};